<?php
	// Load the QCubed Development Framework
	require('../includes/prepend.inc.php');

	/**
	 * This is a quick-and-dirty draft QForm object to do the List All functionality
	 * of the TableProject class.  It uses the code-generated
	 * TableProjectDataGrid control which has meta-methods to help with
	 * easily creating/defining TableProject columns.
	 *
	 * Any display customizations and presentation-tier logic can be implemented
	 * here by overriding existing or implementing new methods, properties and variables.
	 * 
	 * NOTE: This file is overwritten on any code regenerations.  If you want to make
	 * permanent changes, it is STRONGLY RECOMMENDED to move both table_project_list.php AND
	 * table_project_list.tpl.php out of this Form Drafts directory.
	 *
	 * @package My Application
	 * @subpackage Drafts
	 */
	class TableProjectListForm extends QForm {
		// Local instance of the Meta DataGrid to list TableProjects
		protected $dtgTableProjects;

		// Create QForm Event Handlers as Needed

//		protected function Form_Exit() {}
//		protected function Form_Load() {}
//		protected function Form_PreRender() {}
//		protected function Form_Validate() {}

		protected function Form_Run() {
			// Security check for ALLOW_REMOTE_ADMIN
			// To allow access REGARDLESS of ALLOW_REMOTE_ADMIN, simply remove the line below
			QApplication::CheckRemoteAdmin();
		}

		protected function Form_Create() {
			// Instantiate the Meta DataGrid
			$this->dtgTableProjects = new TableProjectDataGrid($this);

			// Style the DataGrid (if desired)
			$this->dtgTableProjects->CssClass = 'datagrid';
			$this->dtgTableProjects->AlternateRowStyle->CssClass = 'alternate';

			// Add Pagination (if desired)
			$this->dtgTableProjects->Paginator = new QPaginator($this->dtgTableProjects);
			$this->dtgTableProjects->ItemsPerPage = 20;

			// Use the MetaDataGrid functionality to add Columns for this datagrid

			// Create an Edit Column
			$strEditPageUrl = __VIRTUAL_DIRECTORY__ . __FORM_DRAFTS__ . '/table_project_edit.php';
			$this->dtgTableProjects->MetaAddEditLinkColumn($strEditPageUrl, 'Edit', 'Edit');

			// Create the Other Columns (note that you can use strings for table_project's properties, or you
			// can traverse down QQN::table_project() to display fields that are down the hierarchy)
			$this->dtgTableProjects->MetaAddColumn('Id');
			$this->dtgTableProjects->MetaAddColumn('CategoryId');
			$this->dtgTableProjects->MetaAddColumn('SubcategoryId');
			$this->dtgTableProjects->MetaAddColumn('Title');
			$this->dtgTableProjects->MetaAddColumn('Description');
			$this->dtgTableProjects->MetaAddColumn('Os');
			$this->dtgTableProjects->MetaAddColumn('Db');
			$this->dtgTableProjects->MetaAddColumn('BudgetMin');
			$this->dtgTableProjects->MetaAddColumn('BudgetMax');
			$this->dtgTableProjects->MetaAddColumn('Featured');
			$this->dtgTableProjects->MetaAddColumn('HideBid');
			$this->dtgTableProjects->MetaAddColumn('HideSearch');
			$this->dtgTableProjects->MetaAddColumn('GoldOnly');
			$this->dtgTableProjects->MetaAddColumn('Enable');
			$this->dtgTableProjects->MetaAddColumn('Sendmail');
			$this->dtgTableProjects->MetaAddColumn('TotalBid');
			$this->dtgTableProjects->MetaAddColumn('TimeLimitDate');
			$this->dtgTableProjects->MetaAddColumn('PostDate');
			$this->dtgTableProjects->MetaAddColumn('CancelDate');
			$this->dtgTableProjects->MetaAddColumn('CloseDate');
			$this->dtgTableProjects->MetaAddColumn('EndDate');
			$this->dtgTableProjects->MetaAddColumn('Status');
			$this->dtgTableProjects->MetaAddColumn(QQN::TableProject()->WonUser);
			$this->dtgTableProjects->MetaAddColumn('AverageBid');
			$this->dtgTableProjects->MetaAddColumn('WonDate');
			$this->dtgTableProjects->MetaAddColumn('StartDate');
			$this->dtgTableProjects->MetaAddColumn('LastBidDate');
			$this->dtgTableProjects->MetaAddColumn('ProgressNumber');
			$this->dtgTableProjects->MetaAddColumn('BudgetExact');
			$this->dtgTableProjects->MetaAddColumn(QQN::TableProject()->User);
			$this->dtgTableProjects->MetaAddColumn('Deadline');
			$this->dtgTableProjects->MetaAddColumn('MainCategoryId');
			$this->dtgTableProjects->MetaAddColumn('BudgetType');
			$this->dtgTableProjects->MetaAddColumn('BuyerUsername');
			$this->dtgTableProjects->MetaAddColumn('ProviderUsername');
			$this->dtgTableProjects->MetaAddColumn('PageView');
		}
	}

	// Go ahead and run this form object to generate the page and event handlers, implicitly using
	// table_project_list.tpl.php as the included HTML template file
	TableProjectListForm::Run('TableProjectListForm');
?>